import time
from Page import Page
from selenium.webdriver.common.by import By

class Page2(Page):

    #点击商品详情
    img_loc = (By.XPATH,'/html/body/div[8]/div[1]/div[2]/div[2]/ul/li[3]/div[1]/a/img')
    def img(self):
        self.click(self.img_loc)

    #加入购物车
    add_loc = (By.ID,'add-cart')
    def add(self):
        self.click(self.add_loc)

    def add_cart(self):
        time.sleep(2)
        self.img()
        time.sleep(2)
        self.add()
        time.sleep(2)
